<?php

	/**
	 * 
	 */
	function get_controller($cname, $appname, $actions=array()){
		
		$app_name = ucfirst(strtolower($appname));
		$controller_name_lc = strtolower($cname);
		$controller_name = ucfirst($controller_name_lc)."_Controller";		
		$str = <<<CONTROL
		<?php
		
		class $controller_name extends $app_name {
			
			private \$view_vars;
			private \$controller;

			public function index(){

				/*
				 * put all application code for the index action here...
				 */
				\$this->display(\$this->controller, __FUNCTION__, \$this->view_vars);
			}
CONTROL

		if(isset($actions)) {
			// add all actions that the user requested
		}

		$str .= <<<CONTROL
			public function __construct(\$get_vars=array()){
				parent::construct(\$get_vars);
				\$this->controller = "$controller_name_lc";
			}

		}

		?>
CONTROL;
	
	return $str;
	
	}

	echo get_controller("test", "pvc");

?>


